package com.simple.cms.common.result;


import com.baomidou.mybatisplus.plugins.Page;

import java.util.ArrayList;
import java.util.List;


public class AjaxPageResult<T> extends CommonResult {

    private static final long serialVersionUID = 3008016488639921969L;

    private int draw;


    // 每页记录数
    private int iDisplayLength;

    // 总记录数
    private int recordsTotal;

    // 过滤后记录
    private int recordsFiltered;

    private List<T> data = new ArrayList<>();

    public AjaxPageResult(List<T> dataList, Page<T> page, int draw) {
        super();

        setData(dataList);
        this.iDisplayLength = page.getSize();
        this.recordsTotal = page.getTotal();
        this.recordsFiltered = page.getTotal();
        this.draw = draw;

    }

    public int getDraw() {
        return draw;
    }

    public void setDraw(int draw) {
        this.draw = draw;
    }

    public int getiDisplayLength() {
        return iDisplayLength;
    }

    public void setiDisplayLength(int iDisplayLength) {
        this.iDisplayLength = iDisplayLength;
    }

    public int getRecordsTotal() {
        return recordsTotal;
    }

    public void setRecordsTotal(int recordsTotal) {
        this.recordsTotal = recordsTotal;
    }

    public int getRecordsFiltered() {
        return recordsFiltered;
    }

    public void setRecordsFiltered(int recordsFiltered) {
        this.recordsFiltered = recordsFiltered;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }
}
